package com.xc.dao;

import com.google.common.collect.Lists;
import com.xc.pojo.UserPosition;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface UserPositionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(UserPosition record);

    int insertSelective(UserPosition record);

    UserPosition selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(UserPosition record);

    int updateByPrimaryKey(UserPosition record);


    UserPosition findPositionBySn(String positionSn);

    List findMyPositionByCodeAndSpell(@Param("uid") Integer uid,
                                     @Param("stockCode") String stockCode,
                                     @Param("stockSpell") String stockSpell,
                                     @Param("state") Integer state);

    List findPositionByUserIdAndSellIdIsNull(Integer userId);

    List listByAgent(@Param("positionType") Integer positionType
            ,@Param("state") Integer state
            ,@Param("userId") Integer userId
            ,@Param("searchId") Integer searchId
            ,@Param("positionSn") String positionSn
            ,@Param("beginTime") Date beginTime
            ,@Param("endTime") Date endTime);

    List findAllStayPosition();

    List findDistinctUserIdList();

    int CountPositionNum(@Param("state") Integer state
            ,@Param("accountType") Integer accountType);


    BigDecimal CountPositionProfitAndLose();
    BigDecimal CountPositionAllProfitAndLose();


}